home *** CD-ROM | disk | FTP | other *** search
/ Celestin Apprentice 7 / Apprentice-Release7.iso / Source Code / C / Applications / Moscow ML 1.42 / src / mosmllib / Byte.sml < prev    next >
Encoding:
Text File  |  1997-08-18  |  636 b   |  17 lines  |  [TEXT/R*ch]

  1. (* Byte -- 1995-11-08, 1996-04-09 *)
  2.  
  3. prim_val byteToChar    : Word8.word -> Char.char = 1 "identity"
  4. prim_val charToByte    : Char.char -> Word8.word = 1 "identity"
  5. prim_val bytesToString : Word8Vector.vector -> String.string = 1 "identity"
  6. prim_val stringToBytes : String.string -> Word8Vector.vector = 1 "identity"
  7.  
  8. fun unpackStringVec arg = bytesToString (Word8Vector.extract arg)
  9. fun unpackString arg = bytesToString (Word8Array.extract arg)
  10.  
  11. fun packString (ss, a, i) =
  12.     let val (s, si, n) = Substring.base ss
  13.     in  
  14.         Word8Array.copyVec {src = stringToBytes s, si = si, 
  15.                 len = SOME n, dst = a, di = i} 
  16.     end
  17.